/**
 * Created by 1 on 2016/10/20.
 */
/**
 * Project  : monkey
 * Author   : Wu Tian Qiang
 * Date     : 2016/10/14 18:39:22
 */
Ext.define('Monkey.view.component.OrgTreePicker', {
    extend: 'Ext.ux.TreePicker',
    xtype: 'orgtreepicker',

    initComponent: function () {
        var me = this;
        me.store = Ext.create('Monkey.store.BaseTreeStore', {
            nodeParam: 'parentId',
            defaultRootId: '1',
            root: {
                expanded: true
            },
            autoLoad: true,
            fields: [
                {name: 'id', type: 'int'},
                {name: 'leaf', type: 'boolean'},
                {name: 'name', type: 'string'},
                {name: 'icon', type: 'string'},
                {name: 'expanded', type: 'boolean', mapping: 'expand'}
            ],
            proxy: {
                type: 'ajax',
                url: Monkey.URL.SERVER_URL + "/m/organization_list.json",
                extraParams: {
                    fields: 'id,leaf,name,icon,expand'
                },
                reader: 'json'
            }
        });
        me.minPickerHeight = 250;
        me.useArrows = true;
        me.displayField = 'name';
        me.rootVisible = false;
        me.editable = false;
        this.callParent();
    }
});